<?php
/**
 * Created by PhpStorm.
 * User: 李迪
 * Date: 2019/2/21
 * Time: 20:38
 */
namespace App\Http\Controllers\Record;

use App\Http\Controllers\BaseApiController;
use App\Services\Record\RecordService;
use App\Services\Resume\ResumeService;
use Validator;
use Illuminate\Http\Request;
/*
 *  简历投递记录
 */
class RecordController extends BaseApiController
{
    private $service;

    public function __construct(RecordService $service)
    {
        //继承基类的构造方法
        parent::__construct();
        //依赖注入service
        $this->service=$service;
    }
    /*
     *  简历投递记录
     */
    public function lists(Request $request){
        // 进行验证 用户id
        $validator = Validator::make($request->all(), [
            'id' => 'required',
        ]);
        // 进行对 验证的判断
        if( $validator->fails() ){
            return 0;
        }
        // 调用service  获取记录
        $res = RecordService::list($request->id);
        return $res;
    }

    /*
     *  查看简历详情
     */
    public function resume(Request $request){
        // 接受简历id
        $validator = Validator::make($request->all(), [
            'id' => 'required',
        ]);
        // 进行对 验证的判断
        if( $validator->fails() ){
            return 0;
        }
        // 查出该条简历详情
        $res = ResumeService::detail($request->id);
        return $res;
    }
}